package com.itheima01;

import java.util.concurrent.ConcurrentHashMap;

public class Test05 {
    public static void main(String[] args) throws InterruptedException {
        ConcurrentHashMap<Integer, Integer> mp = new ConcurrentHashMap<>();

        new Thread(() -> {
            for (int i = 0; i < 25; i++) {
                mp.put(i, i);
            }
        }).start();

        new Thread(() -> {
            for (int i = 25; i < 51; i++) {
                mp.put(i, i);
            }
        }).start();

        Thread.sleep(1000);

        mp.forEach((k, v) -> System.out.println(k + "----" + v));
    }
}
